# file: multicore_test04.py
import machine
import _thread
import utime

led = machine.Pin(25, machine.Pin.OUT)
led.off()

status = 0
data = []
def run_on_core1():
    global status, data
    while True:
        if status:
            led.on()
        else:
            led.off()
        str_data = ''.join(data)
        print("str_data: len=%d content=%s" % (len(str_data), str_data))
        utime.sleep_ms(1000)

def run_on_core0():
    global status, data
    while True:
        status = 1 if not status else 0
        data = []
        for i in range(100):
            data.append(str(status))
            utime.sleep_ms(10)
        utime.sleep_ms(1000)

_thread.start_new_thread(run_on_core1, ( ))
run_on_core0()